<template>
  <div>
    <div class="fenlei">
      <div class="top">
        <p>分类</p>
        <div>
          <input type="text" placeholder="按内容搜索" />
        </div>
      </div>
      <div class="dahezi">
        <ul class="ul1">
          <li v-for="item in arr" :key="item.id">{{item.catename}}</li>
        </ul>
        <div class="div2"></div>
        <div class="dahezi2">
          <div class="box2" v-for="item in arr" :key="item.id">
            <p class="p1">{{item.catename}}</p>
            <div class="xiaotudiv" v-for="i in item.children" :key="i.id">
              <section @click="$router.push('/list?id='+i.id+'&type=2')">
                <img :src="$pre+i.img" alt />
                <p>{{i.catename}}</p>
              </section>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { reqCate } from "../../http/api";
export default {
  mounted() {
    reqCate(this.arr).then((res) => {
      if (res.data.code == 200) {
        this.arr = res.data.list;
      }
    });
  },
  data() {
    return {
      arr: [],
    };
  },
};
</script>

<style scoped>
.fenlei {
  margin: 0 auto;
}
.top {
  background: linear-gradient(to bottom, #ff6040 50%, #ff8a7f 50%);
}
.top p {
  font-size: 0.3rem;
  color: white;
  display: flex;
  justify-content: center;
  line-height: 1rem;
}
.top div {
  display: flex;
  justify-content: center;
  height: 1rem;
}
.top input {
  width: 7.1rem;
  height: 0.65rem;
  background: #ffffff url(../../assets/img/页面-1-index_09.gif) no-repeat left;
  background-size: 0.32rem 0.32rem;
  background-position: 0.2rem 0.2rem;
  border-radius: 2px;
}
.ul1 {
  float: left;
  width: 2.4rem;
  height: 11.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  background-color: white;
  align-self: flex-start;
}
.ul1 li {
  color: #a8a8a8;
}
.ul1 li:hover {
  color: #ff6040;
  font-size: 0.25rem;
  font-weight: bold;
}
.box2 {
  width: 2.46rem;
  background-color: white;
  margin: 0.1rem;
  border:0.2rem solid #ccc;
}

.box2 img {
  width: 1.28rem;
  height: 1.28rem;
}
.box2 .p1 {
  font-size: 0.3rem;
  font-weight: bold;
  text-indent: 0.1rem;
}
.dahezi {
  width:100vw ;
  /* float: left; */
  background-color: #eaeaea;
}
.div2 {
  width: 0.4rem;
}
.dahezi2 {
  float: left;
}
section{
  display: block;
  /* width: 33.33%; */
  border: 0.1rem solid #ccc;
  /* float: left; */
}
</style>